package cupk.abner;

public class HRDepartment extends Department{
    @Override
    public void visitor(FullTimeEmployee employee) {
        int flag = 0;
        int workTime = employee.getWorkTime();
        double weeklyWage = employee.getWeeklyWage();
        if (workTime > 40) {
            flag = 1;
            weeklyWage = weeklyWage + (workTime - 40) * 100;
        } else if (workTime < 40) {
            flag = 2;
            weeklyWage = weeklyWage - (40 - workTime) * 80;
            if (weeklyWage < 0) {
                weeklyWage = 0;
            }
        }
        System.out.println("正式员工 " + employee.getName() + ",工作时间：" + workTime +  "小时");
        if (flag == 1) {
            System.out.println("加班时长：" + (workTime - 40) + "小时");
        } else if (flag == 2) {
            System.out.println("请假时长：" + (40 - workTime) + "小时");
        }
    }

    @Override
    public void visitor(PartTimeEmployee employee) {
        double workTime = employee.getWorkTime();
        System.out.println("临时工 " + employee.getName() + ",工作时间：" + workTime + "小时");
    }
}